<template>
    <div>
        <bi-table :data="list" :loading="loading" min-height="200"  >
            <bi-table-column label="文件" name="name" width="200"></bi-table-column>
            <bi-table-column label="说明" name="title" ></bi-table-column>
            <bi-table-column label="操作" width="150px" v-slot="scope">
                <bi-button  type="primary" @click="del(scope.row)">编辑</bi-button>
                <bi-button  type="warning" @click="del(scope.row)">删除</bi-button>
            </bi-table-column>
        </bi-table>
        <div>
            <bi-button  icon="fa-plus"  type="light"  @click="addFile">添加配置文件</bi-button>
        </div>
    </div>

</template>

<script>
import addFileDiaolog from './add-config-file-dialog.vue';
export default{
    data(){
        return {
            list:[],
            loading:false
        }
    },
    props:{
        app:String
    },
    methods:{
        reFresh(){
            this.loading =  true;
            this.$ajax({
                url:this.$url({controller:'config',action:'list'}),
                data:{
                    app:this.app
                },
                success:(data)=>{
                    console.log(data);
                    this.list = data;
                },
                over:()=>{
                    this.loading = false;
                }
            })
        },
        addFile(){
            this.$dialog({
                type:'vue',
                content:admin.createApp(addFileDiaolog,{app:this.app}),
                callback:(data)=>{
                    this.list.push(data);
                }
            })
        }
    },
    mounted() {
        this.reFresh();
    }

}
</script>